package com.hmall.common.config;

import feign.Logger;
import feign.RequestInterceptor;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author www
 * @Description Feign配置类
 * @Date 2023/4/11 10:33
 * @Version 1.0
 */
@EnableFeignClients(basePackages = "com.hmall.common.client")
@Configuration
public class FeignConfig {

    /**
     * 请求拦截器
     * @return
     */
    @Bean
    public RequestInterceptor requestInterceptor(){
        return new MyFeignInterceptor();
    }

    /**
     * 打印feign请求日志级别
     * BASIC 基本的请求和响应信息
     * @return
     */
    @Bean
    public Logger.Level level(){
        return Logger.Level.BASIC;
    }
}
